import request from '@/utils/request'

export function loginAdmin (data:{adminname:string,password:string}){
  return request({
    url:'/admin/login',
    method:'POST',
    data
  })
}


interface IAddAdminData{
  adminname: string
  password: string
  role: number
  checkedKeys: any[]
}

export function addAdmin (data:IAddAdminData){
  return request({
    url:'/admin/add',
    method:'POST',
    data
  })
}


interface IUpdateAdminData {
  adminname: string
  role: number
  checkedKeys: any[]
}

export  function updateAdmin (data: IUpdateAdminData) {
  return request({
    url: '/admin/update',
    method: 'POST',
    data
  })
}


export  function deleteAdmin (data: { adminid: string }) {
  return request({
    url: '/admin/delete',
    method: 'POST',
    data
  })
}


export  function getAdminDetail (data: { adminname: string }) {
  return request({
    url: '/admin/detail',
    data
  })
}

export  function getAdminList () {
  return request({
    url: '/admin/list'
  })
}